// loadmore.js

const _ = require('lodash');
export const loadMore = (el, binding) => {
  const fun = _.debounce(() => {
    binding.value();
  }, 1000);
  let flag = true;
  el.addEventListener('scroll', () => {
    if (el.scrollHeight - el.offsetHeight === el.scrollTop) {
      if (flag) {
        binding.value();
        flag = false;
      } else {
        fun();
      }
    }
  });
};